package com.team7.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.team7.common.entity.Teacher;
import com.team7.common.vo.AddTeacherVo;
import com.team7.common.vo.CommonResult;
import com.team7.common.vo.TeacherVo;
import com.team7.service.TeacherService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.websocket.server.PathParam;
import java.util.List;

/**
 * @program: team7-Object02
 * @description: 讲师调用层
 * @author: 王子鑫
 * @create: 2021-10-18 22:51
 **/
@RestController
@RequestMapping("service/teacher")
public class TeacherController {

    @Resource
    private TeacherService teacherService;

    @PostMapping("/findAllTeacher/{page}/{limit}")
    public CommonResult findAllTeacher(@PathVariable("page") Integer page, @PathVariable("limit") Integer limit,
                                       @RequestBody TeacherVo teacherVo
                                        ){
        CommonResult allTeacher = teacherService.findAllTeacher(page, limit, teacherVo);
        return allTeacher;
    }

    @PostMapping("/changeStatus")
    public CommonResult changeStatus(@RequestBody TeacherVo teacherVo){
        CommonResult commonResult = teacherService.changeStatus(teacherVo);
        return commonResult;
    }

    @PostMapping("/updateTeacherInfo")
    public CommonResult updateTeacherInfo(@RequestBody TeacherVo teacherVo){
        CommonResult commonResult = teacherService.updateTeacherInfo(teacherVo);
        return commonResult;
    }

    @PostMapping("/addTeacher")
    public CommonResult addTeacher(@RequestBody AddTeacherVo addTeacherVo){
        CommonResult commonResult = teacherService.addTeacher(addTeacherVo);
        return commonResult;
    }
}
